﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace JSEnhancements.JSESettings
{
	public partial class OptionsPageControl : UserControl
	{
		public OptionsPageControl()
		{
			InitializeComponent();
		}

		private OptionsPage optionsPage;

		/// <summary>
		/// Gets or Sets the reference to the underlying OptionsPage object.
		/// </summary>
		public OptionsPage OptionsPage
		{
			get
			{
				return optionsPage;
			}
			set
			{
				optionsPage = value;
				InitView();
			}
		}

		private void InitView()
		{
			chkJSRegions.Checked = optionsPage.AutoCollapseJSRegions;
			chkJSComments.Checked = optionsPage.AutoCollapseJSComments;
			chkJSBraces.Checked = optionsPage.AutoCollapseJSBraces;
			chkJSToDefinitions.Checked = optionsPage.AutoCollapseJSToDefinitions;
			chkCssRegions.Checked = optionsPage.AutoCollapseCssRegions;
			chkCssComments.Checked = optionsPage.AutoCollapseCssComments;
			chkCssBraces.Checked = optionsPage.AutoCollapseCssBraces;			
		}
	
		public void UpdateOptions()
		{
			optionsPage.AutoCollapseJSRegions = chkJSRegions.Checked;
			optionsPage.AutoCollapseJSComments = chkJSComments.Checked;
			optionsPage.AutoCollapseJSBraces = chkJSBraces.Checked;
			optionsPage.AutoCollapseJSToDefinitions = chkJSToDefinitions.Checked;
			optionsPage.AutoCollapseCssRegions = chkCssRegions.Checked;
			optionsPage.AutoCollapseCssComments = chkCssComments.Checked;
			optionsPage.AutoCollapseCssBraces = chkCssBraces.Checked;	
		}
	}
}
